from conftest import login_token
from ApiBase import ApiBase
import pytest,requests,os


class Test_address():
    def test_address_01(self, login_token):
        """创建订单"""
        userId, sessionId = login_token
        # 请求地址
        url = 'http://10.59.9.18/small/order/verify/v1/createOrder'
        # 请求头
        headers = {
            'userId': str(userId),
            'sessionId': str(sessionId)
        }
        # 请求体
        body = {
            "orderInfo": 'commodityId:3,”amount”:1',
            "totalPrice": "100",
            "addressId": 4545,

        }
        # 发送post请求
        r = requests.post(url=url, data=body, headers=headers)
        r_json = r.json()

        print(r_json)

    def test_address_02(self, login_token):
        """创建订单"""
        userId, sessionId = login_token
        # 请求地址
        url = 'http://10.59.9.18/small/order/verify/v1/pay'
        # 请求头
        headers = {
            'userId': str(userId),
            'sessionId': str(sessionId)
        }
        # 请求体
        body = {
            "orderId": '888',
            "payType": 1,

        }
        # 发送post请求
        r = requests.post(url=url, data=body, headers=headers)
        r_json = r.json()

        print(r_json)